function trademark_information(){
	$.ajax({
		url: '/spider-factory/stock/trademark_information',
		type: 'POST',
		data: {
			firm_id: firm_id,
			page: "1",
			size: "10"
		},
		success: function(res){
			let resObj=JSON.parse(res)
			let list=resObj.list
			let num=1
			if(list.length>0){
				for(const i in list){
					$('#trademark_information').append(
						'<tr>'+
							'<td>'+num+'</td>'+
							'<td><img src="'+list[i].mark_style+'" width="120px" height="40px"></td>'+
							'<td>'+list[i].mark_name+'</td>'+
							'<td>'+(list[i].apply_date=="" ? "" : list[i].apply_date.substring(0,10))+'</td>'+
							'<td>'+list[i].markreg_No+'</td>'+
							'<td>'+list[i].mark_type+'</td>'+
						'</tr>'
					)
					num+=1
				}
				if(resObj.totalPage>1){
					$('#trademark_information').append(
							'<tr>'+
								'<td colspan="6" style="text-align:center;"><a href="/spider-factory/stock/trademark_information-more?firm_id='+firm_id+'&companyName='+stock+'" target="_blank">查看更多</a></td>'+
							'</tr>'
						)
				}
			}else{
				$('#trademark_information_show').hide()
			}
		},
		error: function(res){
			console.log(res)
		}
	})
}

function patent_table(){
	$.ajax({
		url: '/spider-factory/stock/patent',
		type: 'POST',
		data: {
			firm_id: firm_id,
			page: "1",
			size: "10"
		},
		success:function(res){
			let resObj=JSON.parse(res)
			let list=resObj.list
			let num=1
			if(list.length>0){
				for(const i in list){
					if(list[i].openDay!==undefined){
						$('#patent').append(
							'<tr>'+
								'<td>'+num+'</td>'+
								'<td>'+list[i].type+'</td>'+
								'<td>'+list[i].openNumber+'</td>'+
								'<td>'+list[i].openDay.substring(0,10)+'</td>'+
								'<td>'+list[i].title+'</td>'+
								'<td><a href="/spider-factory/stock/patent-detail?article_public_id='+list[i].article_public_id+'&companyName='+stock+'" target="_blank">详情</a></td>'+
							'</tr>'
						)
					}else{
						$('#patent').append(
								'<tr>'+
									'<td>'+num+'</td>'+
									'<td>'+list[i].type+'</td>'+
									'<td>'+list[i].openNumber+'</td>'+
									'<td></td>'+
									'<td>'+list[i].title+'</td>'+
									'<td><a href="/spider-factory/stock/patent-detail?article_public_id='+list[i].article_public_id+'&companyName='+stock+'" target="_blank">详情</a></td>'+
								'</tr>'
							)
					}
					num+=1
				}
				if(resObj.totalPage>1){
					$('#patent').append(
						'<tr>'+
							'<td colspan="6" style="text-align:center;"><a href="/spider-factory/stock/patent-more?firm_id='+firm_id+'&companyName='+stock+'" target="_blank">查看更多</a></td>'+
						'</tr>'
					)
				}
			}else{
				$('#patent_show').hide()
			}
		},
		error:function(res){
			console.log(res)
		}
	})
}

function certificate_table(){
	
}

function copyright_table(){
	$.ajax({
		url: '/spider-factory/stock/copyright',
		type: 'POST',
		data: {
			firm_id: firm_id,
			page: "1",
			size: "10"
		},
		success:function(res){
			let resObj=JSON.parse(res)
			let list=resObj.list
			let num=1
			if(list.length>0){
				for(const i in list){
						$('#copyright').append(
							'<tr>'+
								'<td>'+num+'</td>'+
								'<td>'+list[i].name+'</td>'+
								'<td>'+(list[i].publish_date===undefined ? "" : list[i].publish_date.substring(0,10))+'</td>'+
								'<td>'+(list[i].complete_date===undefined ? "" : list[i].complete_date.substring(0,10))+'</td>'+
								'<td>'+list[i].register_no+'</td>'+
								'<td>'+(list[i].register_date===undefined ? "" : list[i].register_date.substring(0,10))+'</td>'+
								'<td>'+list[i].type+'</td>'+
							'</tr>'
						)
						num+=1
					}
				if(resObj.totalPage>1){
					$('#copyright').append(
						'<tr>'+
							'<td colspan="7" style="text-align:center;"><a href="/spider-factory/stock/copyright-more?firm_id='+firm_id+'&companyName='+stock+'" target="_blank">查看更多</a></td>'+
						'</tr>'
					)
				}
			}else{
				$('#copyright_show').hide()
			}
		},
		error:function(res){
			console.log(res)
		}
	})
}

function software_table(){
	$.ajax({
		url: '/spider-factory/stock/software',
		type: 'POST',
		data: {
			firm_id: firm_id,
			page: "1",
			size: "10"
		},
		success:function(res){
			let resObj=JSON.parse(res)
			let list=resObj.list
			let num=1
			if(list.length>0){
				for(const i in list){
						$('#software').append(
							'<tr>'+
								'<td>'+num+'</td>'+
								'<td>'+(list[i].register_date===undefined ? "" : list[i].register_date.substring(0,10))+'</td>'+
								'<td>'+list[i].name+'</td>'+
								'<td>'+list[i].abbr+'</td>'+
								'<td>'+list[i].register_no+'</td>'+
								'<td>'+list[i].type+'</td>'+
								'<td>'+list[i].industry_type+'</td>'+
								'<td>'+list[i].version_no+'</td>'+
							'</tr>'
						)
						num+=1
					}
				if(resObj.totalPage>1){
					$('#software').append(
						'<tr>'+
							'<td colspan="8" style="text-align:center;"><a href="/spider-factory/stock/software-more?firm_id='+firm_id+'&companyName='+stock+'" target="_blank">查看更多</a></td>'+
						'</tr>'
					)
				}
			}else{
				$('#software_show').hide()
			}
		},
		error:function(res){
			console.log(res)
		}
	})
}

function website_table(){
	$.ajax({
		url: '/spider-factory/stock/website',
		type: 'POST',
		data: {
			firm_id: firm_id,
			page: "1",
			size: "10"
		},
		success: function(res){
			let resObj=JSON.parse(res)
			let list=resObj.list
			let num=1
			if(list.length>0){
				let urlArr=[]
				let domainArr=[]
				for(const i in list){
						let url=""
						let domain=""
						urlArr=JSON.parse(list[i].url)
						domainArr=JSON.parse(list[i].domain)
						if(urlArr.length>1){
							let num=1
							for(const d of urlArr){
								if(num==1){
									url+='<p style="margin-bottom:0px;">'+d+'</p>'
								}else{
									url+='<p style="margin-bottom:0px;" class="url">'+d+'</p>'
								}
								num+=1
							}
							url+='<p id="look2" name="more2" onclick="look2()" style="margin-bottom:0px;cursor:pointer;color:rgb(41,114,250);">查看更多</p>'
						}else{
							url+=urlArr[0]
						}
						if(domainArr.length>1){
							let num=1
							for(const d of domainArr){
								if(num==1){
									domain+='<p style="margin-bottom:0px;">'+d+'</p>'
								}else{
									domain+='<p style="margin-bottom:0px;" class="domain">'+d+'</p>'
								}
								num+=1
							}
							domain+='<p id="look" name="more" onclick="look()" style="margin-bottom:0px;cursor:pointer;color:rgb(41,114,250);">查看更多</p>'
						}else{
							domain+=domainArr[0]
						}
						$('#website').append(
							'<tr>'+
								'<td>'+num+'</td>'+
								'<td>'+url+'</td>'+
								'<td>'+list[i].website_name+'</td>'+
								'<td>'+domain+'</td>'+
								'<td>'+list[i].icpNo+'</td>'+
							'</tr>'
						)
						num+=1
					}
				if($('.domain').length>0){
					$('.domain').hide()
				}
				if($('.url').length>0){
					$('.url').hide()
				}
				if(resObj.totalPage>1){
					$('#website').append(
						'<tr>'+
							'<td colspan="5" style="text-align:center;"><a href="/spider-factory/stock/website-more?firm_id='+firm_id+'&companyName='+stock+'" target="_blank">查看更多</a></td>'+
						'</tr>'
					)
				}
			}else{
				$('#website_show').hide()
			}
		},
		error: function(res){
			console.log(res)
		}
	})
}

function look(){
	if($('#look').attr('name')=='more'){
		$('.domain').show()
		$('#look').text('收起')
		$('#look').attr('name', 'less')
	}else{
		$('.domain').hide()
		$('#look').text('查看更多')
		$('#look').attr('name', 'more')
	}
}
function look2(){
	if($('#look2').attr('name')=='more2'){
		$('.url').show()
		$('#look2').text('收起')
		$('#look2').attr('name', 'less2')
	}else{
		$('.url').hide()
		$('#look2').text('查看更多')
		$('#look2').attr('name', 'more2')
	}
}